import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 考题管理信息 */
export interface StudentAnswer {
          paperId?: number; // 试卷ID
          questionNo?: number; // 题号
          studentAnswer: string; // 学生答案
          aiRecognizedAnswer: string; // AI答案
          score: number; // 得分
          isCorrect: number; // 错对
          deductionReason: string; // 扣分原因
          manualScore: number; // 人工审核得分
          manualComment: string; // 教师批注
          markedBy: string; // 批阅方式
  }

// 考题管理 API
export const StudentAnswerApi = {
  // 查询考题管理分页
  getStudentAnswerPage: async (params: any) => {
    return await request.get({ url: `/exam/student-answer/page`, params })
  },

  // 查询考题管理详情
  getStudentAnswer: async (id: number) => {
    return await request.get({ url: `/exam/student-answer/get?id=` + id })
  },

  // 新增考题管理
  createStudentAnswer: async (data: StudentAnswer) => {
    return await request.post({ url: `/exam/student-answer/create`, data })
  },

  // 修改考题管理
  updateStudentAnswer: async (data: StudentAnswer) => {
    return await request.put({ url: `/exam/student-answer/update`, data })
  },

  // 删除考题管理
  deleteStudentAnswer: async (id: number) => {
    return await request.delete({ url: `/exam/student-answer/delete?id=` + id })
  },

  /** 批量删除考题管理 */
  deleteStudentAnswerList: async (ids: number[]) => {
    return await request.delete({ url: `/exam/student-answer/delete-list?ids=${ids.join(',')}` })
  },

  // 导出考题管理 Excel
  exportStudentAnswer: async (params) => {
    return await request.download({ url: `/exam/student-answer/export-excel`, params })
  },
}